<?php
session_start();
require 'connection.php';
require 'util.php';
$buttonString;
$htmlString;
if(isLoggedIn())
{
	logout();
	$buttonString = "LOG IN";
	$htmlString = "";
}
else
{
	$htmlString = "
			<div id=\"loginLayerContents\" class=\"loginLayerContentsBox\">
				<div id=\"loginPanel\">
					<div>
						<form method=\"post\" action=\"#\" name=\"login\">
							<div>
								<!--USER ID-->
								<label>
									User id
								</label>
								<input type=\"text\" id=\"user_id\"/>

								<!--PASSWORD -->
								<label>
									Password
								</label>
								<input type=\"password\" id=\"user_pw\" />

								<!--LOGIN BUTTON -->
								<input type=\"submit\" value=\"log in\" />
								<a href=\"#\">Forgot your password?</a>
							</div>
						</form>
					</div>
					<div>
						<p>You don't have an account yet?</p>
						<a href=\"#\" id=\"loginRegisterLink\">Register</a>
					</div>
				</div>
			</div>";
	$buttonString = "LOG IN";
}
$response = array(
	"htmlString" => $htmlString,
	"buttonString" => $buttonString
	);
echo json_encode($response);
//echo json_decode("{$jsonResponse}");

?>